from selenium import webdriver
import time
from selenium.webdriver.common.by import By
# 打开百度浏览器,打开so浏览器
driver = webdriver.Chrome()
driver.get("https://www.so.com/")
# 搜索框输入'python自动化测试',点击百度一下
kw = driver.find_element(By.ID,"input")
#send_keys()文本框写入值
kw.send_keys("python自动化测试")
# 点击一下搜索按钮
su = driver.find_element(By.ID,"search-button")
# 按钮点击 click()
su.click()
# 获取页面标题,并打印出来
time.sleep(3)
print(driver.title)
# 检查'python' 关键字是否在标题中
if "python" in driver.title:
    print('抓到了')
else:
    print('没抓到')

# 关闭so360浏览器
time.sleep(2)
driver.quit()